// Copyright © SixtyFPS GmbH <info@slint.dev>
// SPDX-License-Identifier: MIT

import { Switch, GridBox, ListView, ScrollView, HorizontalBox, VerticalBox, Palette } from "std-widgets.slint";

import { GallerySettings } from "../gallery_settings.slint";

export component Page inherits VerticalBox {
    in property<string> title: "title";
    in property<string> description: "description";
    in property<bool> show-enable-switch: true;

    HorizontalBox {
        Text {
            font-size: 20px;
            text <=> root.title;
        }

        // Spacer
        Rectangle {}

        if show-enable-switch: Switch {
            horizontal-stretch: 0;
            text: @tr("Widgets enabled");
            checked <=> GallerySettings.widgets-enabled;
            enabled: true;
        }

        Switch {
            horizontal-stretch: 0;
            text: @tr("Dark Mode");
            checked: Palette.color-scheme == ColorScheme.dark;
            toggled => {                
                Palette.color-scheme = self.checked ? ColorScheme.dark : ColorScheme.light;
            }
        }
    }

    @children
}